<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>预算定制</title>
<%@include file="/common/meta.jsp"%>
<%@include file="/common/validator.jsp"%>
<style type="text/css">

.budgetTable {
	margin: auto;
	border-top: 1px solid #000000;
	border-left: 1px solid #000000;
}

.budgetTable tr td {
	height:25px;
	line-height:25px;
	border-bottom: 1px solid #000000;
	border-right: 1px solid #000000;
	font-family: sans-serif;
}

.budgetTable tr th {
	background-color: #ECECEC;
	height:30px;
 	font-weight: bold;
 	font-size:13px;
 	text-align: center;
	border-bottom: 1px solid #000000;
	border-right: 1px solid #000000;
	font-family: sans-serif;
}

.itemInfo{
    line-height: 20px;
    font-family: sans-serif;
}

.showBorder{
	margin:auto;
	border:0px;
	border-bottom:1px solid red;
	height:20px;
	width: 105px;
	color: green;
	text-align: right;
}

.budgetItem {
	margin:auto;
	border: 0px;
	height:20px;
	width: 105px;
	color: green;
	text-align: right;
}
</style>
</head>
<body>
	<div style="margin: 5px;">
		<%@ include file="/common/messages.jsp"%>
	</div>
	<input type="button" value="保存预算" class="button" onclick="submitData()" style="margin-top: 5px; margin-left: 5px;">
	&nbsp;&nbsp;	
	<input type="button" value="返回列表" class="button" onclick="gotoIndex()" style="margin-top: 5px; margin-left: 5px;">
    <s:form id="sharingForm" action="update.do" method="post" cssStyle="margin:5px;">
	  <s:hidden name="model.id" />
	  <table class="budgetTable" cellpadding="0" cellspacing="0">
	    <tr>
	      <th colspan="5">
	        <div style="font-size: 14px;">${model.year}年度公用费用分摊</div>
	      </th>
	    </tr>
	    <tr>
	      <th width="150">部门编号</th>
	      <th width="150">部门名称</th>
	      <th width="150">科目编号</th>
	      <th width="150">科目名称</th>
	      <th width="120">金额</th>
	    </tr>
	    <s:iterator value="model.sharingItems" var="sitem">
	     <tr>
	      <td>&nbsp;${sitem.dept.serialNo}</td>
	      <td>&nbsp;${sitem.dept.name}</td>
	      <td>&nbsp;${sitem.item.code}</td>
	      <td>&nbsp;${sitem.item.name}</td>
	      <td align="center">
	        <input type="hidden" name="sharingItemIds" value="${sitem.id}">
	        <input type="text" name="amount_${sitem.id}" value="${sitem.amount}" maxlength="12" class="budgetItem" onfocus="showBorder(this)" onblur="hiddenBorder(this)">
	      </td>
	    </tr>
	    </s:iterator>
	    <tr>
	      <td align="center" colspan="3">
	        &nbsp;制单人：&nbsp;&nbsp;${model.creater.name}
	      </td>
	      <td align="right">合&nbsp;计：</td>
	      <td>&nbsp;<span style="color: red;">${model.amount}</span></td>
	    </tr>
	  </table>
	</s:form>
<script type="text/javascript">
  function showBorder(obj){
	  obj.className = 'showBorder';
  }
  
  function hiddenBorder(obj){
	  obj.className = 'budgetItem';
  }
  
  function submitData(){
	  document.getElementById("sharingForm").submit();
  }
  
  function gotoIndex(){
	  window.location.href = "index.do";
  }
</script>
</body>
</html>